package com.huike.business.service.impl;


import com.fasterxml.jackson.databind.util.BeanUtil;
import com.huike.business.domain.TbBusiness;
import com.huike.business.domain.TbBusinessTrackRecord;
import com.huike.business.domain.vo.BusinessTrackVo;
import com.huike.business.mapper.TbBusinessTrackRecordMapper;
import com.huike.business.service.ITbBusinessService;
import com.huike.business.service.ITbBusinessTrackRecordService;
import com.huike.clues.domain.TbClueTrackRecord;
import com.huike.clues.service.ITbClueTrackRecordService;
import com.huike.common.utils.bean.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商机跟进记录Service业务层处理
 * 
 * @author wgl
 * @date 2021-04-28
 */
@Service
public class TbBusinessTrackRecordServiceImpl implements ITbBusinessTrackRecordService {

    @Autowired
    private ITbBusinessService businessService;
    @Autowired
    private TbBusinessTrackRecordMapper tbBusinessTrackRecordMapper;
    @Override
    public void add(BusinessTrackVo businessTrackVo) {
        TbBusiness tbBusiness = businessService.selectTbBusinessById(businessTrackVo.getBusinessId());
        BeanUtils.copyProperties(businessTrackVo,tbBusiness);
        businessService.updateTbBusiness(tbBusiness);
 /*       tbBusiness.setPhone(businessTrackVo.getPhone());
        tbBusiness.setChannel(businessTrackVo.getChannel().toString());
        tbBusiness.setProvinces(businessTrackVo.getProvinces());
        tbBusiness.setCity(businessTrackVo.getCity());
        tbBusiness.setSex(businessTrackVo.getSex());
        tbBusiness.setAge(businessTrackVo.getAge());
        tbBusiness.setName(businessTrackVo.getName());
        tbBusiness.setJob(businessTrackVo.getJob());
        tbBusiness.setEducation(businessTrackVo.getEducation());*/
        TbBusinessTrackRecord tbBusinessTrackRecord = new TbBusinessTrackRecord();
        BeanUtils.copyProperties(businessTrackVo,tbBusinessTrackRecord);
        //新增商机跟进表数据
        tbBusinessTrackRecordMapper.add(tbBusinessTrackRecord);
    }

    @Override
    public List<TbBusinessTrackRecord> selectTbBusinessTrackRecordById(Long id) {
        List<TbBusinessTrackRecord> list=tbBusinessTrackRecordMapper.selectTbBusinessTrackRecordById(id);
        return list;
    }
}
